package com.william.yun.yunliwuli.api.rest;

import com.alibaba.fastjson.JSONObject;
import com.william.yun.yunliwuli.api.HttpResponse;
import com.william.yun.yunliwuli.api.request.store.StoreRequest;
import com.william.yun.yunliwuli.api.response.store.StoreResponse;
import com.william.yun.yunliwuli.service.impl.StoreServiceImpl;

/**
 * ClassName: StoreApi <br/>
 * Description:  门店<br/>
 * date: 2021/3/12 16:52<br/>
 *
 * @author william <br/>
 */
public class StoreApi extends BaseApi{
    /**
     * 查看门店信息
     * @param token
     * @return
     */
    public StoreResponse store(String token){
        JSONObject jsonObject = new StoreServiceImpl().postStoreQuery(null, token);
        return JSONObject.toJavaObject(jsonObject, StoreResponse.class);
    }

    /**
     * 添加门店
     * @param request
     * @param token
     * @return
     */
    public HttpResponse addStore(StoreRequest request, String token){
        JSONObject jsonObject = new StoreServiceImpl().postStoreAdd(getJsonParam(request), token);
        return JSONObject.toJavaObject(jsonObject, HttpResponse.class);
    }

}
